import QtQuick 2.12
import QtQuick.Controls 2.12

Button {
    id: cusButton;
    height: 26;
    width: 200;

    property int radius: 5;

    property color backgroundColorNormal: "transparent"
    property color backgroundColorHovered: "#eaf6fd"
    property color backgroundColorPressed: "#d7ebfa"
    property color backgroundColorDisable: "#b6bdc5"

    // 字体颜色
    property color textColor: "#38a9e4"

    property color backgroundColor: {
        if (!cusButton.enabled) {
            return backgroundColorDisable
        } else if (cusButton.pressed) {
            return backgroundColorPressed
        } else if(cusButton.selected){
            return backgroundColorPressed
        } else if (cusButton.hovered) {
            return backgroundColorHovered
        } else {
            return backgroundColorNormal
        }
    }


    // 字体
    contentItem: Text {
        text: cusButton.text
        color: cusButton.textColor
        font.pixelSize: 16;
    }

    // 文字
    background: Rectangle{
        anchors.fill: parent;
        radius: cusButton.radius
        color: cusButton.backgroundColor;
        border.color: "#38a9e4";
        border.width: 1;
    }
}



